package org.newlucene.core.analysis;

/*
 * "Tokenizes" the entire stream as a single token. 
 * This is useful for data like zip codes, ids, and some product names. 
 */
public class KeywordAnalyzer implements Analyzer
{
    private String text;
    private boolean hasNext = false;

    public KeywordAnalyzer()
    {
    }
    
    public void set(String text)
    {
       this.text = text;
       this.hasNext = true;
    }
    
    public Token next()
    {
        if (hasNext)
        {
            hasNext = false;
            return new Token(text);
        }
        else
        {
            return null;
        }
    }
}
